<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/tag.jsp"%>
<ul class="nav nav-tabs">
    <li class="active m_swift" id="m_undo" onclick="swift(this)" >
        <a class="btn">
            待审批任务
            <span class="badge">${unhandledNotes.size()}</span>
        </a>
    </li>
    <li class="m_swift" id="m_done" onclick="swift(this)">
        <a class="btn">
            已审批任务
            <span class="badge">${handledNotes.size()}</span>
        </a>
    </li>

</ul>
<ul id="m-items">
    <c:forEach items="${unhandledNotes}" var="n">
        <c:if test="${unhandledNotes.size()==0}">
            <li class="m_undo" style="list-style-type: none">
                无待审批任务
            </li>
        </c:if>
        <li class="m_undo">
            提交人：${n.submitter.realName}
            <br/>
            提交日期：<fmt:formatDate value="${n.generateDate}" pattern="yyyy年MM月dd日hh点mm分"/>
            <br/>
            <a class="home_b_item btn" style="cursor: pointer;" onclick="missionDetail(${n.missionId})">
                查看任务详情 »»
            </a>

            <a class="home_b_item btn" style="cursor: pointer;" onclick="noteDetail(${n.id})">
                审核 »»
            </a>
        </li>
    </c:forEach>
    <c:forEach items="${handledNotes}" var="n">
        <li class="m_done hidden">
            提交人：${n.submitter.realName}
            <br/>
            提交日期：<fmt:formatDate value="${n.generateDate}" pattern="yyyy年MM月dd日hh点mm分"/>
            <br/>
            <a class="home_b_item btn" style="cursor: pointer;" onclick="missionDetail(${n.missionId})">
                查看任务详情 »»
            </a>

            <a class="home_b_item btn" style="cursor: pointer;" onclick="noteDetail(${n.id})">
                详情 »»
            </a>
        </li>
    </c:forEach>
</ul>
<script type="application/javascript">
    function noteDetail(noteId){
        home.b.getNoteById(noteId);
    }
    function missionDetail(missionId){
        home.b.getMissionById(missionId);
    }
    function swift(node){
        $(".m_swift").removeClass("active");
        $("#"+node.id).addClass("active");
        $("#m-items li").addClass("hidden");
        $("."+node.id).removeClass("hidden");
    }
</script>